package com.atguigu.lease.web.admin.controller.apartment;

import com.atguigu.lease.common.result.Result;
import com.atguigu.lease.web.admin.service.PaymentService;
import com.atguigu.lease.module.entity.PaymentType;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/payment")
@Tag(name = "支付方式管理",description = "PaymentTypeController")
public class PaymentTypeController {

    @Autowired
    private PaymentService paymentService;

    @Operation(summary = "查询列表")
    @GetMapping("list")
    public Result<List<PaymentType>> getPaymentType(){
        return Result.ok(paymentService.list());
    }

    @PostMapping("saveOrUpdate")
    @Operation(summary = "保存或更新")
    public Result saveOrUpdate(@RequestBody PaymentType paymentType){
        paymentService.saveOrUpdate(paymentType);
        return Result.ok();
    }

    @DeleteMapping("delete")
    @Operation(summary = "删除列表")
    public Result delete(Long id){
        paymentService.removeById(id);
        return Result.ok();
    }



}
